﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;

namespace YXShop.Web.admin.templates.lable
{
    public partial class advertise_parameter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Get("include\\advertise");
            }
        }
        #region 显示文件目录
        /// <summary>
        /// 显示文件目录
        /// </summary>
        public void Get(string name)
        {
            string str_lujing = "~\\" + name;
            DirectoryInfo[] ChildDirectory;                         //子目录集
            FileInfo[] NewFileInfo;                                //当前所有文件
            DirectoryInfo FatherDirectory = new DirectoryInfo(Server.MapPath(str_lujing)); //当前目录
            ChildDirectory = FatherDirectory.GetDirectories("*.*"); //得到子目录集
            NewFileInfo = FatherDirectory.GetFiles();//得到文件集，可以进行操作
            string str_html = "<table width=\"100%\" id=\"tablist\"  cellspacing=\"0\" cellpadding=\"0\" border=\"1\" bordercolorlight=\"#DDDDDD\""
            + "class=\"datatable\" bordercolordark=\"#FFFFFF\"><tr class='TrTitle' bgcolor='#78B9E6' style='color: White' height='25'><th width='25%'>文件名称</th><th width='10%'>类型</th><th width='10%'>大小</th>"
            + "<th width='20%'>最后修改时间</th></tr>";
            foreach (FileInfo fi in NewFileInfo)//显示文件
            {
                if (fi.Name.Contains(".JS"))
                {
                    string strh1 = "<tr height='25'><td><a href=\"javascript:filename('" + fi.Name + "');ReturnValue();\">" + fi.Name + "</a></td><td>" + fi.Extension + "文件</td><td  align='center'>" + fi.Length + "字节</td><td  align='center'>"
                    + fi.LastWriteTimeUtc + "</td></tr>";
                    str_html += strh1;
                }
            }
            str_html += "</table>";
            this.Literal1.Text = str_html;
        }
        #endregion
    }
}
